{% extends 'generic.html' %}
{% load i18n %} {# Translating code #}
        
{% block cssBlock %}        
	<link href="/media/prettify/prettify.css" type="text/css" rel="stylesheet" />
	<link href="/media/css/{{request.session.theme}}/pageSee/style.css" type="text/css" rel="stylesheet" />
{% endblock %}

{% block jsBlock %}
	<script type="text/javascript" src="/media/prettify/prettify.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			var lst = $("article").find("h1,h2,h3,h4,h5,h6,h7,h8,h9");
			if( lst.length > 0){
				var aside = jQuery("<aside><ul></ul></aside>");
				var incid = 1;
				aside.find("ul").append(jQuery('<li class="indexHeader">{% blocktrans %}Page index{% endblocktrans %}</li>'));
				$.each(lst, function() {
					var li = jQuery('<li><a href=""></a></li>');
					
					$(this).attr('id', "headerid"+incid);
					li.addClass(""+this.tagName.toLowerCase());
					if($(this).find("a").length > 0){
						li.find("a").html($(this).find("a").html()).attr('href', "#headerid"+(incid++));
					}else{
						li.find("a").html($(this).html()).attr('href', "#headerid"+(incid++));
					}
					
					aside.find("ul").append(li);
				});
				$("article").prepend(aside);
			}
			
	  		prettyPrint();
	  		
	  		// Change the behavior of 'remove' button
			$('a[href$="/erase/"]').click(function(event){
				event.preventDefault();
				if(confirm("{% blocktrans %}You are about to remove this page, all of its resources, versions and sub-pages. Are you sure you want to proceed?{% endblocktrans %}")){
					location.href=$(this).attr("href");
				}
			});
		});
	</script>
	<script type="text/javascript" src="/media/aloha/loaderAloha.js"></script><!---->
	
	<!--<script type="text/javascript" src="/media/aloha/aloha.js"></script>
	<script type="text/javascript" src="/media/aloha/plugins/com.gentics.aloha.plugins.Format/plugin.js"></script>
	<script type="text/javascript" src="/media/aloha/plugins/com.parallelplatform.aloha.plugins.Sections/plugin.js"></script>
	<script type="text/javascript" src="/media/aloha/plugins/com.gentics.aloha.plugins.Table/plugin.js"></script>
	<script type="text/javascript" src="/media/aloha/plugins/com.gentics.aloha.plugins.List/plugin.js"></script>
	<script type="text/javascript" src="/media/aloha/plugins/com.gentics.aloha.plugins.Link/plugin.js"></script>
	<script type="text/javascript" src="/media/aloha/plugins/com.gentics.aloha.plugins.Link/LinkList.js"></script>
	<script type="text/javascript" src="/media/aloha/plugins/com.parallelplatform.aloha.plugins.Save/plugin.js"></script>
	<script type="text/javascript" src="/media/aloha/plugins/com.parallelplatform.aloha.plugins.Resources/plugin.js"></script>
	<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
	<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
	<link href="/media/prettify/prettify.css" type="text/css" rel="stylesheet" />
	<script type="text/javascript" src="/media/prettify/prettify.js"></script>
	<script type="text/javascript" src="/media/aloha/settings.js"></script>-->
	
	<script type="text/javascript" src="/media/aloha/loaderInSee.js"></script>
	
{% endblock %}
     
{% block nav %}
    <nav>
		<ul><!-- Navigator of followed path -->
			<!-- These will be autofilled -->
			{% for url,page in list %}
				<li><a href="{{url}}" title="{{page.title}}">{{page.title}}</a></li>
			{% endfor %}
			
		</ul>
		
		<ul> <!-- Navigator to change back/next page -->
			<!-- These are static (always the same) -->
			{% if previous %}
			<li><a href="/{{previous.uuid}}/" title="{{previous.getRevisionValid.title}}">{{previous.getRevisionValid.title}}</a></li>
			{% endif %}
			{% if next %}
			<li><a href="/{{next.uuid}}/" title="{{next.getRevisionValid.title}}">{{next.getRevisionValid.title}}</a></li>
			{% endif %}
		</ul>
    </nav>
{% endblock %}    

{% block article %}

	<header id="title">
		{% block title %}
			{{page.title}}
		{% endblock %}
	</header>
	
	{% block content %}
		<div id="content">
			{% autoescape off %}
				{{page.content}}
			{% endautoescape %}
		</div>
		{% if listChildren != "" %}
			<section id="subpage">
				<header>{% blocktrans %}Children List{% endblocktrans %}</header>
				{% autoescape off %}
					{{listChildren}}
				{% endautoescape %}
			</section>
		{% endif %}
	
		<section class="languages">
			<header>{% blocktrans %}Available in:{% endblocktrans %}</header>
			<ul>
				{% for lang in languages %}
				<li class="{{ lang.0 }}"><span>{{lang.1}}</span></li>
				{% endfor %}
			</ul>
		</section>
		<section class="colaborators">
			<header>{% blocktrans %}Colaborators to this page {% endblocktrans %}</header>
			<ul>
			{% for o in collaborators %}
				<li> {{ o.username }} </li>
			{% endfor %}
			</ul>
			<br><span>v.{{page.version}}</span>
		</section>
	{% endblock %}
        	
{% endblock %}
              
{% block loggedoptions %}

	{% if user.is_authenticated %}
		{% if options.edit %}
			{% if LANGUAGE_CODE != page.lang %}
				<a href="/{{page.page.uuid}}/edit/?lang={{page.lang}}">{% blocktrans %}Translate{% endblocktrans %}</a>
			{% else %}
				<a href="/{{page.page.uuid}}/edit/">{% blocktrans %}Edit{% endblocktrans %}</a>
			{%endif%}
		{%endif%}
		{% if options.newChildren %}
		<a href="/{{page.page.uuid}}/create/">{% blocktrans %}Add page{% endblocktrans %}</a>
		{%endif%}
		{% if options.disable %}
			<a href="/{{page.page.uuid}}/disable/">{% blocktrans %}Disable{% endblocktrans %}</a>
		{%endif%}
		{% if options.enable %}
			<a href="/{{page.page.uuid}}/enable/">{% blocktrans %}Enable{% endblocktrans %}</a>
		{%endif%}
		{% if options.erase %}
			<a href="/{{page.page.uuid}}/erase/">{% blocktrans %}Erase{% endblocktrans %}</a>
		{%endif%}
		{% if options.commit %}
			<a href="/{{page.page.uuid}}/commit/{{page.lang}}/{{page.version}}">{% blocktrans %}Commit{% endblocktrans %}</a>
		{%endif%}

	{% endif %}

{% endblock %}
